package com.fgchen.mapper.study02;

import com.fgchen.domain.study02.Animal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;

/**
 * Created by Administrator on 2018-04-08.
 */
public interface AnimalMapper {
    @Select("select * from animals")
    Collection<Animal> findAll();

    @Select("select * from animals where id = #{id}")
    Animal get(@Param("id") Long id);

    @Insert("insert into animals(name, age) values (#{name}, #{age})")
    int insert(@Param("name") String name, @Param("age") Integer age);
}
